<template>
  <div>
    <div class="top">
      <nav>
        <msgTop />
      </nav>
      <van-icon @click="study()" name="bag-o" />
    </div>
    <router-view />

    <!-- <router-view /> -->
    <bom-bar />
  </div>
</template>

<script>
export default {
  beforeRouteLeave(to, from, next) {
    if (confirm("还有消息没看呢，确定要离开吗？")) {
      next();
    } else {
      next(false);
    }
  },
  methods: {
    study() {
      this.$router.push("/study");
    },
  },
};
</script>

<style scoped>
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 0.55rem;
  background: #39c0ba;
  padding: 0 0.2rem;
  box-sizing: border-box;
  position: fixed;
  top: 0;
  z-index: 2;
}

.top > i {
  width: 0.26rem;
  font-size: 0.26rem;
  color: #fff;
}
</style>